package com.p2p.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.p2p.model.entity.Employee;
import com.p2p.model.entity.Logininfo;
import com.p2p.model.vo.EmployeeQueryVo;
import com.p2p.system.mapper.EmployeeMapper;
import com.p2p.system.service.EmployeeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 黄旭彬
 * @since 2023-12-14
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService {

    @Override
    public IPage<Employee> selectEmpList(Page<Employee> pageParam, EmployeeQueryVo employeeQueryVo) {
        return this.baseMapper.selectEmpPage(pageParam,employeeQueryVo);
    }

    @Override
    public Employee getByEmail(String email) {
        QueryWrapper<Employee> email1 = new QueryWrapper<>();
        email1.eq("empEmail", email);
        return this.baseMapper.selectOneByEmail(email1);
    }

    @Override
    public Employee getUserByPhone(String phone) {

        QueryWrapper<Employee> employeeQueryWrapper = new QueryWrapper<>();
        employeeQueryWrapper.eq("empPhone", phone);

        return this.baseMapper.selectOne(employeeQueryWrapper);
    }
}
